﻿Imports System.Data.OleDb

Public Class UserPrivilegesDAO
    Public Function UserPrivileges_Select(ByVal UserAccountID As Integer) As DataSet
        Dim para(0) As OleDbParameter
        para(0) = New OleDbParameter("@UserAccountID", UserAccountID)
        para(0).OleDbType = OleDbType.Integer
        Return objConnectionDAO.ExecuteStoreprocedure("spTDT_UserPrivileges_Select", para)
    End Function

    Public Function UserPrivileges_Insert(ByVal UserAccountID As Integer, _
                                          ByVal PrivilegeID As Integer, _
                                          ByVal NoneFlag As Boolean, _
                                          ByVal ReadOnlyFlag As Boolean, _
                                          ByVal FullFlag As Boolean, _
                                          ByVal ModifiedOn As Date, _
                                          ByVal ModifiedBy As String, _
                                          ByVal CreatedOn As Date, _
                                          ByVal CreatedBy As String) As Boolean
        Dim para(8) As OleDbParameter
        para(0) = New OleDbParameter("@UserAccountID", UserAccountID)
        para(0).OleDbType = OleDbType.Integer

        para(1) = New OleDbParameter("@PrivilegeID", PrivilegeID)
        para(1).OleDbType = OleDbType.Integer

        para(2) = New OleDbParameter("@NoneFlag", NoneFlag)
        para(2).OleDbType = OleDbType.Boolean

        para(3) = New OleDbParameter("@ReadOnlyFlag", ReadOnlyFlag)
        para(3).OleDbType = OleDbType.Boolean

        para(4) = New OleDbParameter("@FullFlag", FullFlag)
        para(4).OleDbType = OleDbType.Boolean

        para(5) = New OleDbParameter("@ModifiedOn", ModifiedOn)
        para(5).OleDbType = OleDbType.Date

        para(6) = New OleDbParameter("@ModifiedBy", ModifiedBy)
        para(6).OleDbType = OleDbType.VarWChar

        para(7) = New OleDbParameter("@CreatedOn", CreatedOn)
        para(7).OleDbType = OleDbType.Date

        para(8) = New OleDbParameter("@CreatedBy", CreatedBy)
        para(8).OleDbType = OleDbType.VarWChar

        Return objConnectionDAO.ExecuteStoreprocedureNoneReturn("spTDT_UserPrivileges_Select", para)
    End Function

    Public Function UserPrivileges_Update(ByVal UserAccountID As Integer, _
                                          ByVal PrivilegeID As Integer, _
                                          ByVal NoneFlag As Boolean, _
                                          ByVal ReadOnlyFlag As Boolean, _
                                          ByVal FullFlag As Boolean, _
                                          ByVal ModifiedOn As Date, _
                                          ByVal ModifiedBy As String, _
                                          ByVal CreatedOn As Date, _
                                          ByVal CreatedBy As String, _
                                          ByVal LastAccessTime As Date) As Boolean
        Dim para(9) As OleDbParameter
        para(0) = New OleDbParameter("@UserAccountID", UserAccountID)
        para(0).OleDbType = OleDbType.Integer

        para(1) = New OleDbParameter("@PrivilegeID", PrivilegeID)
        para(1).OleDbType = OleDbType.Integer

        para(2) = New OleDbParameter("@NoneFlag", NoneFlag)
        para(2).OleDbType = OleDbType.Boolean

        para(3) = New OleDbParameter("@ReadOnlyFlag", ReadOnlyFlag)
        para(3).OleDbType = OleDbType.Boolean

        para(4) = New OleDbParameter("@FullFlag", FullFlag)
        para(4).OleDbType = OleDbType.Boolean

        para(5) = New OleDbParameter("@ModifiedOn", ModifiedOn)
        para(5).OleDbType = OleDbType.Date

        para(6) = New OleDbParameter("@ModifiedBy", ModifiedBy)
        para(6).OleDbType = OleDbType.VarWChar

        para(7) = New OleDbParameter("@CreatedOn", CreatedOn)
        para(7).OleDbType = OleDbType.Date

        para(8) = New OleDbParameter("@CreatedBy", CreatedBy)
        para(8).OleDbType = OleDbType.VarWChar

        para(0) = New OleDbParameter("@LastAccessTime", LastAccessTime)
        para(0).OleDbType = OleDbType.Date

        Return objConnectionDAO.ExecuteStoreprocedureNoneReturn("spTDT_UserPrivileges_Update", para)
    End Function

    Public Function Privileges_Lookup() As DataSet
        Return objConnectionDAO.ExecuteStoreprocedure("spTDT_Privileges_Lookup", Nothing)
    End Function



End Class
